<template>
    <div>
        <el-popover
                placement="down"
                width="400"
                trigger="click" v-model="priceForm" ref="update_priceList_modal" style="position: relative">
            <el-form ref="form" :model="priceList" label-width="150px" class="update-form">
                <el-form-item label="单证号">
                    <el-input v-model="priceList.documentnumber"></el-input>
                </el-form-item>

                <el-form-item label="实际承运人名称">
                    <el-input v-model="priceList.carrier"></el-input>
                </el-form-item>

                <el-form-item label="车辆牌照号">
                    <el-input v-model="priceList.vehiclenumber"></el-input>
                </el-form-item>

                <el-form-item label="车牌颜色代码">
                    <el-input v-model="priceList.vehicleplatecolorcode"></el-input>
                </el-form-item>

                <el-form-item label="运单上传时间">
                    <el-input v-model="priceList.sendtoprodatetime" disabled></el-input>
                </el-form-item>

                <el-form-item label="实际承运人统一社会信用代码或证件号码">
                    <el-input v-model="priceList.actualcarrierid"></el-input>
                </el-form-item>

                <el-form-item label="appkey">
                    <el-input v-model="priceList.appkey"></el-input>
                </el-form-item>
                运单列表:
                <el-form-item label="托运单号">
                    <el-input v-model="priceList.shippingnotelist.shippingnotenumber"></el-input>
                </el-form-item>

                <el-form-item label="分段分单号">
                    <el-input v-model="priceList.shippingnotelist.serialnumber"></el-input>
                </el-form-item>

                <el-form-item label="总金额">
                    <el-input v-model="priceList.shippingnotelist.totalmonetaryamount"></el-input>
                </el-form-item>
                财务列表:
                <el-form-item label="付款方式代码">
                    <el-input v-model="priceList.financiallist.paymentmeanscode"></el-input>
                </el-form-item>

                <el-form-item label="收款方银行代码">
                    <el-input v-model="priceList.financiallist.bankcode"></el-input>
                </el-form-item>

                <el-form-item label="流水号序列号">
                    <el-input v-model="priceList.financiallist.sequencecode"></el-input>
                </el-form-item>
                <el-form-item label="实际支付金额">
                    <el-input v-model="priceList.financiallist.monetaryamount"></el-input>
                </el-form-item>

                <el-form-item label="日期时间">
                    <el-input v-model="priceList.financiallist.datetime"></el-input>
                </el-form-item>

                <el-form-item label="收款方名称">
                    <el-input v-model="priceList.financiallist.recipient"></el-input>
                </el-form-item>

                <el-form-item label="收款帐户信息">
                    <el-input v-model="priceList.financiallist.receiptaccount"></el-input>
                </el-form-item>

                <el-form-item>
                    <el-button type="primary" @click="onSubmit('priceForm')">立即创建</el-button>
                    <el-button @click="hideForm('priceForm')">取消</el-button>
                </el-form-item>
            </el-form>
            <el-button slot="reference">上传资金流水</el-button>
        </el-popover>
    </div>
</template>

<script>
    export default {
        name: "priceList",
        data(){
            return {
                priceForm: false,
                priceList: {
                    documentnumber: '20200520001',  //单证号
                    carrier: '营口瑞盈物流有限公司（张三）',  //实际承运人名称
                    vehiclenumber: '辽H78747',   //车辆牌照号
                    vehicleplatecolorcode: '2', //车牌颜色代码
                    sendtoprodatetime: '###TIME###', //运单上传时间
                    actualcarrierid: '210423197605212813',  //实际承运人统一社会信用代码或证件号码
                    appkey: '13762',    //appkey
                    shippingnotelist: { //运单列表
                        shippingnotenumber: 'YD19102600043',    //托运单号
                        serialnumber: '0000',   //分段分单号
                        totalmonetaryamount: '999.999', //总金额
                    },
                    financiallist: {    //财务列表
                        paymentmeanscode: '9',  //付款方式代码
                        bankcode: '9999',   //收款方银行代码
                        sequencecode: '950380060681',   //流水号序列号
                        monetaryamount: '999.999',  //实际支付金额
                        datetime: '20200519174959', //日期时间
                        recipient: '营口东方融发物流有限公司',  //收款方名称
                        receiptaccount: '7218010182600034730',  //收款帐户信息
                    },
                }
            }
        },
        methods: {
            defaultPrice() {
                return `
        <reqInfo>
<root>
<header>
	<messagereferencenumber>###UUID###</messagereferencenumber>
	<documentname>资金流水单</documentname>
	<documentversionnumber>2.0</documentversionnumber>
	<sendercode>210000</sendercode>
	<enterprisesendercode>2113762</enterprisesendercode>
	<messagesendingdatetime>###TIME###</messagesendingdatetime>
	<ipctype>WLHY_ZJ1001</ipctype>
	<token>427690567060f4d98f24c10099fcaa98</token>
	<messagefunctioncode>9</messagefunctioncode>
	<recipientcode>wcjc0002</recipientcode>
</header>
`
            },
            onSubmit(formName){
                this.hideForm(formName)
                let header = this.defaultPrice()
                let str = `
               ${header}<body>
<documentnumber>${this.priceList.documentnumber}</documentnumber>
<carrier>${this.priceList.carrier}</carrier>
<vehiclenumber>${this.priceList.vehiclenumber}</vehiclenumber>
<vehicleplatecolorcode>${this.priceList.vehicleplatecolorcode}</vehicleplatecolorcode>
<sendtoprodatetime>${this.priceList.sendtoprodatetime}</sendtoprodatetime>
<actualcarrierid>${this.priceList.actualcarrierid}</actualcarrierid>
<appkey>${this.priceList.appkey}</appkey>
<shippingnotelist>
	<shippingnotenumber>${this.priceList.shippingnotelist.shippingnotenumber}</shippingnotenumber>
	<serialnumber>${this.priceList.shippingnotelist.serialnumber}</serialnumber>
	<totalmonetaryamount>${this.priceList.shippingnotelist.totalmonetaryamount}</totalmonetaryamount>
</shippingnotelist>
<financiallist>
	<paymentmeanscode>${this.priceList.financiallist.paymentmeanscode}</paymentmeanscode>
	<bankcode>${this.priceList.financiallist.bankcode}</bankcode>
	<sequencecode>${this.priceList.financiallist.sequencecode}</sequencecode>
	<monetaryamount>${this.priceList.financiallist.monetaryamount}</monetaryamount>
	<datetime>${this.priceList.financiallist.datetime}</datetime>
	<recipient>${this.priceList.financiallist.recipient}</recipient>
	<receiptaccount>${this.priceList.financiallist.receiptaccount}</receiptaccount>
</financiallist>
</body>
</root>
</reqInfo>
                `
                console.log(str);
                this.cusMark()
                this.api.dataPost.priceInfo(str).then((res) => {
                    console.log(res);
                    this.handleRes(res)
                }).catch((res) => {
                    console.log(res);
                })
            },
        },
        mounted() {
        }
    }
</script>

<style scoped>

</style>